﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LoungeRepo.Core;
using LoungeRepo.Core.Extensions;

namespace Prefetching_all_entities
{
    class Program
    {
        static void Main(string[] args)
        {
            PopulateRepository();

            using(var repo = new LoungeRepository())
            {
                repo.PrefetchAllEntities();

                foreach (string p in repo.GetExtent<string>().Where(n=>n.StartsWith("paul")))
                    Console.WriteLine(p);
            }
        }


        private static void PopulateRepository()
        {
            using(var repo = new LoungeRepository())
            {
                repo.Store("peter", "1", "architect");
                repo.Store("mary", "2", "lead");
                repo.Store("paul", "3", "programmer");
                repo.Store("dennis", "4", "programmer");
                repo.Store("paula", "5", "scrummaster");
                repo.Store("kathleen", "6", "productowner");
            }
        }
    }
}
